<?php
use App\Utils;
?>
@extends('layouts.master3')
@section("title")
{{$task->title}}的学习资料
@endsection
@section('edstyle')
    <link rel="stylesheet" href="/css/edit/style.css">
    <link rel="stylesheet" href="/css/edit/editormd.css">
    <link rel="stylesheet" href="/css/highlight/styles/github.css">
<style>
			body{padding-bottom:0;}
			#layout{
				width: 1070px;
				margin: 0 auto;
			}
			input.btn{
				margin:20px 60px ;
			}
            li{list-style: inherit;}
		</style>
<link rel="stylesheet" type="text/css" href="/css/discuss.css">
<link href="/css/study_data.css" rel="stylesheet">

@endsection


@section('content')


<!-- Main Content -->
<div id="layout">
    <a class="task_title" href="/task/{{Utils::id2url($task->id)}}">{{$task->title}}</a>
    <div class="clearfix"></div>

   <div class="qa-a-list" id="a_list" style="margin-left:120px;">
@foreach($comments as $com)
            <div class="qa-a-list-item  hentry answer" id="{{Utils::id2url($com->id)}}">
                <div class="vote pull-left">
                    <button class="up @if($com->fav==0) press @endif" data-token="{{csrf_token()}}" data-id="{{$com->id}}" data-type="2" title="赞同">
                        <i class="vote_arrow"></i>
                        <span class="count" data-count="{{$com->vote}}">{{$com->vote}}</span>
                    </button>
                    <!--  <button class="down" data-statu="false" title="反对，不显示名字">
                          <i class="vote_arrow"></i>
                      </button>-->
                </div>
                <div class="qa-a-item-main">

                    <div class="qa-a-item-content">
                        <a  class="qa-user-link fl black" target="_blank" href="/profile/{{Utils::id2url($com->userid)}}">{{$com->user->name}}</a>，  {{$com->user->introduce}}
                        <a  target="_blank" href="/profile/{{Utils::id2url($com->userid)}}"><img src="{{$com->user->avatar->url("thumb")}}" width="30" height="30" class="fr avatar"></a>
<div class="clear"></div>
                        <div class="entry-content markdown-body"><p><?php echo $com->comment;?></p></div>
                    </div>
                    <span class="qa-a-item-avatar-meta">

                        <span class="qa-a-item-meta">
                            <span class="qa-a-item-when">{{$com->created_at}}回答 
@if (Auth::user()->id==$com->userid)
<a target="_blank" class="gray" href="/task/{{Utils::id2url($task->id)}}/contribute/{{Utils::id2url($com->id)}}"> 编辑 </a>
@endif
</span>
                            <a href="javascript:;" class="gray _pl"> {{count($com->notes)}}条评论</a>

                        </span>

                    </span>
                    <div class="dc none" >
                        <div class="qa-comment-list">
@foreach($com->notes as $r)
                            <div class="media" id="">
                                <a class="pull-left" target="_blank" href="/profile/{{Utils::id2url($r->user->id)}}">
                                    <img class="img-circle avatar" alt="Cinque Terre" width="20" height="20" src="{{$r->user->avatar->url("thumb")}}">
                                </a>
                                <div class="media-body">
                                    <input type="hidden" class="replyName" value="{{$r->user->name}}">
                                    <h4 class="media-heading"><a  target="_blank" href="/profile/{{Utils::id2url($r->user->id)}}" class="gray">{{$r->user->name}}</a> @if($r->ruserid!=0) 回复了 <a  target="_blank" href="/profile/{{Utils::id2url($r->ruserid)}}" class="gray">{{$r->ruser->name}} </a>@endif
                                        <!--<a target="_blank" href="/admin/del?id=3445">删除</a>-->
                                    </h4>
{{$r->comment}}
                                    <div class="ql_comment_ft">
                                        <span class="date">{{$r->created_at}}</span>
                                        <?php
                                            if(Auth::user()->id!==$r->user->id){
                                                echo '<a href="javascript:;" class="reply ql_comment_op_link gray" name="reply_comment">回复</a>';
                                            }
                                        ?>
                                       
                                    </div>

                                    <div class="ql_comment_form expanded" style="display: none;">
                                        <div class="ql_comment_editable_wrap">
                                            <input class="ql_comment_editable editable"  placeholder="写下你的回复" type="text">
                                        </div>
                                        <div class="ql_command ql_clear">
                                            <a href="javascript:;" class="btn btn-primary pull-right replyBtn" data-mid="{{Utils::id2url(Auth::user()->id)}}" data-id="{{$com->id}}" data-rid="{{Utils::id2url($r->user->id)}}" data-name="{{Auth::user()->name}}" data-token="{{csrf_token()}}" data-img="{{Auth::user()->avatar->url('thumb')}}" data-rtype="2">回复</a>
                                            <a href="javascript:;" class="ql_comment_close ql_command_cancel">取消</a>
                                        </div>
                                    </div>
                                </div>
                            </div><!-- media END-->
@endforeach
                            
                        </div>
                        <div class="qa-a-reply">
                            <input class="ql_comment_editable editable"  placeholder="写下你的回复" type="text">
                            <div class="ql_command ql_clear none">
                                <a href="javascript:;" class="btn btn-primary pull-right qa-replyBtn" data-mid="{{Utils::id2url(Auth::user()->id)}}" data-id="{{$com->id}}" data-token="{{csrf_token()}}" data-name="{{Auth::user()->name}}" data-img="{{Auth::user()->avatar->url('thumb')}}" data-rtype="2">回复</a>
                                <a href="javascript:;" class="qa-ql_comment_close qa-ql_command_cancel">取消</a>
                            </div>
                        </div>
                    </div>

                </div> <!-- END qa-a-item-main -->
                <div class="qa-a-item-clear"></div>


            </div> <!-- END qa-a-list-item -->
@endforeach
 
        </div> <!-- END qa-a-list -->

    <!-- end-->
    <br>
    <hr style="width: 90%;margin: 0 auto;">
    <br>


    <!--
        <form method="POST" action="http://www.qlcoder.com/task/7581/contribute" accept-charset="UTF-8"><input name="_token" type="hidden" value="6y8N0IN40iEcBwGxi0I1LyjR9N3VdXcvBqIFUWIu">
        <div id="test-editormd">
        <textarea name="text" style="display:none;"></textarea>
        </div>
    <input name="cid" type="hidden" value="0" id="cid">
    </div>
    <a class="btn btn-default" type="submit">保存</a>

      </form>
    -->
    {!! Form::open(['url'=>'/task/'.Utils::id2url($task->id).'/contribute']) !!}
        <div style="width:90%;margin:20px auto;">
            <h4 id="share">与同行分享你的经验和见解<small style="float:right;margin-top: -10px;"><br><a target="_blank" href="/help?tag=material#material">撰写规范>></a></small><h4>
        </div>
        <div id="test-editormd">
            <textarea name="text" style="display:none;"></textarea>
        </div>
        <input name="cid" type="hidden" value="0" id="cid">
        <input class="btn btn-primary pull-right" type="submit" value="保存">
    </form>

</div>
<br>
<br>
<br>
<br>
@stop
@section("js")
<!--
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>
<script type="text/javascript"
        src="/js/MathJax.js">
</script>
-->
<script src="/js/editormd.js?v=1.0"></script>
<script src="/js/vote.js"></script>
<script src="/js/reply.js"></script>
<script type="text/javascript">
    var testEditor;
    $(function() {
        editormd.methodOne = function() {
        };

        testEditor = editormd("test-editormd", {
            width  : "90%",
            height : 600,
            toolbarAutoFixed:false,
            path   : '/lib/',
            onload : function() {
            }
        });

        editormd.methodOne();
    });
</script>
<script src="/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
@stop
